﻿using System;
using System.Collections.Generic;

namespace NodeJS
{
    public abstract class Util
    {
        /// <summary>
        /// Returns a formatted string using the first argument as a printf-like format.
        /// </summary>
        /// <param name="format">a string that contains zero or more placeholders. Each placeholder is replaced with the converted value from its corresponding argument. Supported placeholders are:
        /// <para>%s - String.</para>
        /// <para>%d - Number (both integer and float).</para>
        /// <para>%j - JSON.</para>
        /// <para>% - single percent sign ('%'). This does not consume an argument.</para>
        /// If the placeholder does not have a corresponding argument, the placeholder is not replaced.</param>
        /// <param name="args"></param>
        /// <returns></returns>
        public abstract string Format(string format, params object[] args);

        /// <summary>
        /// A synchronous output function. Will block the process and output string immediately to stderr.
        /// </summary>
        /// <param name="message"></param>
        public abstract void Debug(string message);

        /// <summary>
        /// Same as util.debug() except this will output all arguments immediately to stderr.
        /// </summary>
        /// <param name="args"></param>
        public abstract void Error(params object[] args);

        /// <summary>
        /// A synchronous output function. Will block the process and output all arguments to stdout with newlines after each argument.
        /// </summary>
        /// <param name="args"></param>
        public abstract void Puts(params object[] args);

        /// <summary>
        /// A synchronous output function. Will block the process, cast each argument to a string then output to stdout. Does not place newlines after each argument.
        /// </summary>
        /// <param name="args"></param>
        public abstract void Print(params object[] args);

        /// <summary>
        /// Output with timestamp on stdout.
        /// </summary>
        /// <param name="message"></param>
        public abstract void Log(string message);

        /// <summary>
        /// Return a string representation of object, which is useful for debugging.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="options">An optional options object may be passed that alters certain aspects of the formatted string:
        /// <para>showHidden - if true then the object's non-enumerable properties will be shown too. Defaults to false.</para>
        /// <para>depth - tells inspect how many times to recurse while formatting the object. This is useful for inspecting large complicated objects. Defaults to 2. To make it recurse indefinitely pass null.</para>
        /// <para>colors - if true, then the output will be styled with ANSI color codes. Defaults to false. Colors are customizable, see below.</para>
        /// <para>customInspect - if false, then custom inspect() functions defined on the objects being inspected won't be called. Defaults to true.</para>
        /// </param>
        public abstract void Inspect(object obj, Dictionary<string, object> options = null);

        /// <summary>
        /// Returns true if the given "object" is an Array. false otherwise.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public abstract bool IsArray(object obj);

        /// <summary>
        /// Returns true if the given "object" is a RegExp. false otherwise.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public abstract bool IsRegExp(object obj);

        /// <summary>
        /// Returns true if the given "object" is a Date. false otherwise.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public abstract bool IsDate(object obj);

        /// <summary>
        /// Returns true if the given "object" is an Error. false otherwise.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public abstract bool IsError(object obj);

        /// <summary>
        /// Inherit the prototype methods from one constructor into another. The prototype of constructor will be set to a new object created from superConstructor.
        /// As an additional convenience, superConstructor will be accessible through the constructor.super_ property.
        /// </summary>
        /// <param name="constructor"></param>
        /// <param name="superConstructor"></param>
        //Note: should not call directly, was include in class inherit synatx translate
        //public abstract void Inherits(object constructor, object superConstructor);

    }
}
